;; -*- emacs-lisp -*-

;; Use cperl-mode instead of the default perl-mode


(add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))

(define-auto-insert 'cperl-mode  '(nil "#!/usr/bin/perl -w\n\n" ))
(add-hook 'find-file-hooks 'auto-insert)

(defun n-cperl-mode-hook ()
  (require 'gud)
  (require 'cperl-mode)
  (require 'eip_perldb-gui)
  (require 'linum)
  (setq cperl-indent-level 4)
  (setq cperl-continued-statement-offset 0)
  (setq cperl-extra-newline-before-brace t)
  (set-face-background 'cperl-array-face "wheat")
  (set-face-background 'cperl-hash-face "wheat")
  (cperl-toggle-abbrev)
  (cperl-toggle-electric)
  (cperl-toggle-auto-newline)
  (cperl-toggle-autohelp)
  
  (setq cperl-hairy t)
  (setq cperl-lazy-help-time 1)
  (linum-mode)
  (define-key cperl-mode-map [(meta o)] 'eip-perl-db)
  (define-key cperl-mode-map [(meta p)] 'eip-perl-db-current-buffer)
  (define-key cperl-mode-map [f5] 'eip-perl-db-current-buffer)
  (define-key cperl-mode-map [C-f5] 'eip-perl-current-buffer)
  (define-key cperl-mode-map [return] 'newline-and-indent))
(add-hook 'cperl-mode-hook 'n-cperl-mode-hook t)
